<template>
	<view class="comment">
		<view class="header">
			用户评论
		</view>
		<view class="comGrounp" v-for="(v,i) in commentText" :key="i">
			<view class="portrait">
				<image :src="v.evalueLogo" mode=""></image>
			</view>
			<view class="commentText">
				<view>
					<view>
						<view>{{v.feels}}</view>
						<view>{{v.service}}</view>
					</view>
					<view>
						<view>适合新手</view>
						<view>强度适中</view>
					</view>
				</view>
				<view>
					<text>{{v.content}}</text>
				</view>
				<view class="commentImage">
					<image :src="v.evalueImage" mode="" ></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {reactive,toRefs} from 'vue'
	import myRequest from '../../../utils/myRequest.js'
	import {
		onLoad
	} from '@dcloudio/uni-app'
	export default{
		setup(){
			let data=reactive({
				mycomment:[],
				commentText:[
				],
				init() {
					myRequest({
						url: '/getevaluation'
					}).then((res) => {
						let comment = res.data.data
						return myRequest({
							url:'/getcoach',
						}).then((res2)=>{
							let allcoach=res2.data.data
							let getcoachId=allcoach.filter((x,index)=>{
								return x.coachName==this.mycomment.courseCoach
							})
							this.commentText=comment.filter((x,index)=>{
								return x.evaluatCoach==getcoachId[0].coachId
							})							
						})
					})
				}
			});
			onLoad((option)=>{
				let resdata = JSON.parse(decodeURIComponent(option.data))
				data.mycomment=resdata
				data.init()				
			})
			return {...toRefs(data)}
		}
	}
</script>

<style>
	.comment {
		padding: 20rpx;
	}
	
	.header {
		font-size: 40rpx;
		font-weight: bold;
	}
	
	.portrait>image {
		width: 80rpx;
		height: 80rpx;
		border-radius: 80rpx;
	}
	
	.comGrounp {
		display: flex;
	}
	
	.commentText {
		padding-left: 15rpx;
		flex: 1;
	}
	
	.commentText>view:first-child {
		display: flex;
		justify-content: space-between;
		padding-right: 10rpx;
	}
	
	.commentText>view:first-child>view:first-child>view:last-child {
		font-size: 25rpx;
		color: #999999;
		margin: 10rpx 0;
	}
	
	.commentText>view:first-child>view:last-child {
		display: flex;
	}
	
	.commentText>view:first-child>view:last-child>view {
		background: #FFCC66;
		color: #FFFFFF;
		width: 150rpx;
		margin-right: 20rpx;
		line-height: 60rpx;
		text-align: center;
		border-radius: 20rpx;
		height: 60rpx;
	}
	
	.commentImage>image {
		width: 200rpx;
		height: 200rpx;
		margin: 15rpx;
	}
</style>

